#include "MBConversionMethods.h"

#include <BaseTsd.h>
#include <sstream>

using std::string;
using std::stringstream;
using std::ostringstream;

/**
  * Converts a double value to an std:string
  * @param doubleValue the double value to convert to an std::string
  * @return string-representation of the double value
  */
string MB::DoubleToString( const double &doubleValue )
{
	ostringstream strs;
	strs << doubleValue;
	return strs.str();
}

/**
  * Converts a MBuint value to an std:string
  * @param mbuintValue the MBuint value to convert to an std::string
  * @return string-representation of the MBuint value
  */
string MB::MBuintToString( const MBuint &mbuintValue )
{
	ostringstream strs;
	strs << mbuintValue;
	return strs.str();
}

/**
  * Converts an std:string to a double value
  * @param stringValue the string to convert to an int value
  * @return double-representation of the string
  */
double MB::StringToDouble( const string &stringValue )
{
	stringstream ss_stream(stringValue);
    double d_return;
    ss_stream >> d_return;

    return d_return;
}

/**
  * Converts an std:string to a MBuint value
  * @param stringValue the string to convert to an int value
  * @return MBuint-representation of the string
  */
MBuint MB::StringToMBuint( const string &stringValue )
{
	stringstream ss_stream(stringValue);
	MBuint uint32_return;
	ss_stream >> uint32_return;

	return uint32_return;
};